package com.boco.modules.fdoc.web.sigserverpack;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.boco.common.web.ServletController;
import com.boco.modules.fdoc.service.SigServicepackService;
import com.boco.modules.fdoc.vo.SigServicepackVo;

/**
 * 根据签约服务包编号逻辑删除签约服务包中间关系
 * ClassName: DeleteSigSvsPackDtlRlnCtr <br/>
 * Function: TODO ADD FUNCTION. <br/>
 * Reason: TODO ADD REASON(可选). <br/>
 * date: 2016年9月28日 上午11:08:50 <br/>
 *
 * @author ken
 * @version 
 * @since JDK 1.7+
 */
@Controller
@RequestMapping(value = "/sigserverpack")
public class DeleteSigSvsPackDtlRlnCtr extends ServletController{
	@Resource
	SigServicepackService sigServicepackService;
	
	@RequestMapping(value = "/deleteSvsPackRlns",method = RequestMethod.POST)
	public String deleteSvsPackRlns(SigServicepackVo vo, HttpServletRequest request, HttpServletResponse response,
			Model model) {
		int[] detailsIds=vo.getSvsPackDtlIds();
		int sigId=vo.getId();
		System.out.println("====================签约服务表id"+sigId+"=================签约服务中间"+detailsIds);
		if (detailsIds!=null&&detailsIds.length>0&&sigId>0) {
			for (int detailsId:detailsIds) {
				sigServicepackService.deleteSigSvsPackDtlsRln(sigId, detailsId);
			}
			
		}
	return "/sigsvspack/sigsvsedit";
	}
	
	@RequestMapping(value = "/deleteSvsPackRln",method = RequestMethod.POST)
	public String deleteSvsPackRln(SigServicepackVo vo, HttpServletRequest request, HttpServletResponse response,
			Model model) {
		int detailsId=vo.getDetailsId();
		int sigId=vo.getSigId();
		System.out.println("====================签约服务表id"+sigId+"=================签约服务中间"+detailsId);
		if (detailsId!=0&&sigId!=0) {
			sigServicepackService.deleteSigSvsPackDtlsRln(sigId, detailsId);
		}
		request.setAttribute("successdelete","删除服务中间详情成功！" );
	return "/sigsvspack/stsDteSvsPackDtl";
	}
	
	}
